package com.renjie.homework;

class RightTriangle extends Shape {
    private int base;
    private int height;

    public RightTriangle(int base, int height) {
        this.setBase(base);
        this.setHeight(height);
    }

    public int getBase() {
        return base;
    }

    public void setBase(int base) {
        if (base >= 1 && base <= 20) {
            this.base = base;
        }
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        if (height >= 1 && height <= 20)
            this.height = height;
    }

    @Override
    public void draw() {
        for (int i = 0; i < this.height; i++) {
            for (int j = 0; j < 2 * i + 1; j++) {
                System.out.print("*");
            }
            System.out.println("");
        }
    }
}
